<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
	</head>
	<body>
		<input type="button" value="get请求" class="get" />
		<input type="button" value="post请求" class="post" />
		<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
		<script type="text/javascript">
			//接口1
			document.querySelector(".get").onclick = function(){
					axios.get("https://autumnfish.cn/api/joke?num=3")
					.then(function(response){
						console.log(response);
					},function(err){
						console.log(err);
					})
			}
				// 接口2
				document.querySelector(".post").onclick = function(){
					axios.post("https://baidu.com",{username:"小江江"})
					.then(function(response){
						console.log(response);
					},function(err){
						console.log(err);
					})
				}
		</script>
	</body>
</html>
